package com.github.admin.edu.oauth.server.api.hystris;

import com.github.admin.edu.assembly.common.entity.JsonEntity;
import com.github.admin.edu.assembly.common.util.JsonUtils;
import com.github.admin.edu.oauth.server.api.entity.TSequence;
import com.github.admin.edu.oauth.server.api.entity.TSysOrganization;
import com.github.admin.edu.oauth.server.api.service.ServiceObjectIdManagerApi;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * Create by IntelliJ IDEA
 * 用户：王建
 * 日期：2018-8-3
 */
@Component
public class ServiceObjectIdManagerHystris implements FallbackFactory<ServiceObjectIdManagerApi> {
    @Override
    public ServiceObjectIdManagerApi create(Throwable throwable) {
        return new ServiceObjectIdManagerApi() {
            @Override
            public String getObjectId(String obj) {
                return JsonUtils.toJson(new JsonEntity<TSequence>("服务端异常，无法连接！"));
            }
        };
    }
}
